<#include "header1.ftl"/>
<style>
    .login{
        padding: 0;
        height: 50px;
        background: #5a84fd;
        color: #fff;
        font-size: 14px;
        text-transform: uppercase;
        box-shadow: 0 5px 30px rgba(0,66,255,.3);
        border: 1px solid transparent;
    }
    .form-control{
        height: 40px !important;
    }
</style>
<#include "header2.ftl"/>
<div class="main" style="margin-top: 20px;">
    <div class="container">
        <ul class="breadcrumb" id="categoryName">
            <li class="active">用户登录</li>
        </ul>
        <div class="row margin-bottom-40">

            <div id="myOrderDiv" class="col-md-12 col-sm-12">
                <div id="myOrderDiv" class="col-md-6 col-sm-6 col-md-offset-3 col-sm-offset-3"  >
                <div class="form-group">
                    <label for="email-login">用户名</label>
                    <input type="text" id="userName" name="userName" class="form-control" placeholder="请输入用户名或邮箱">
                </div>
                <div class="form-group">
                    <label for="password-login">密码</label>
                    <input type="password" id="userPwd" name="userPwd" class="form-control" placeholder="请输入密码">
                </div>
                <div style="text-align: right">
                <a href="javascript:void(0);" onclick="toRegister()">注册账号</a>|<a href="javascript:void(0);" onclick="toChangePassword()">忘记密码?</a>
                </div>
                <div class="padding-top-20">
                    <button class="col-md-12 login" type="button" id="loginButton">登录</button>
                </div>
            </div>
            </div>

        </div>
    </div>
    <!-- END CONTENT -->
</div>
<#include "footer1.ftl"/>
<script>
    $("#loginButton").on('click',function () {
        var userName = $("#userName").val();
        var userPwd = $("#userPwd").val();
        if (userName == '' || userPwd == ''){
            layer.msg("用户名或密码不能为空");
            return;
        }
        var index = layer.load(3);
        $.post('/member/login',{userName:userName,userPwd:userPwd},function (data) {
            layer.close(index);
            if (data.success){
                window.location.href = '/';
            } else{
                layer.msg(data.message);
            }
        })
    })

    function toRegister() {
        window.location = "/register";
    }

    function toChangePassword() {
        window.location = "/changePassword";
    }
</script>
<#include "footer2.ftl"/>
